package net.wicp.tams.common.es.client.threadlocal;

import net.wicp.tams.common.es.client.ESClient;
import net.wicp.tams.common.thread.threadlocal.ObjectCreator;
import net.wicp.tams.common.thread.threadlocal.PerthreadManager;

public class EsClientThreadlocal implements ObjectCreator<ESClient> {

	private static final String perVarEsClient = "perVarEsClient";

	private EsClientThreadlocal() {
	}

	@Override
	public ESClient createObject() {
		ESClient retobj = new ESClient();
		return retobj;
	}

	public static ESClient createPerThreadEsClient() {
		ObjectCreator<ESClient> creator = PerthreadManager.getInstance().createValue(perVarEsClient,
				new EsClientThreadlocal());
		return creator.createObject();
	}

}
